﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/AdminSite.Master" Inherits="System.Web.Mvc.ViewPage<IPagedList<MensUnoShop.Models.OrderData>>" %>
<%@ Import Namespace="MvcPaging"%>  
<%@ Import Namespace="MensUnoShop.Helpers" %>
<%@ Import Namespace="MensUnoShop.Areas.Admin.Helpers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	歷史清單
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
	    <div id="main-content" class="hastable">
		    <div class="title title-spacing">
			    <h2>歷史訂單</h2>
					依下列條件查詢所有歷史訂單
		    </div>
            <%using (Html.BeginForm("GetOrder", "OrderManagement", FormMethod.Post, new { @class = "shBox" }))
            {%>
            <select id="querychoice" name="querychoice">
                <option value="queryall">不限條件</option>
                <option value="querytxid">訂單編號</option>
                <option value="querycashid">金流編號</option>
                <option value="queryemail">會員帳號(E-Mail)</option>
                <option value="querymname">會員姓名</option>
            </select>
            <%:Html.Hidden("querytype", "history")%>
            <input type="text" id="querycontent" name="querycontent" />
            <input type="submit" class="submit" value="查詢訂單" />
            <%} %>

            <%if (Model != null && Model.Count > 0)
              {%>
              <input type="button" id="getexcel" name="getexcel" value="匯出" onclick="javascript:location.href='GetExcel/HistoryList';" />
            <%} %>

            <ul class="pagination">
            <%= Html.UPager(Model.PageSize, Model.PageNumber, Model.TotalItemCount)%>
            </ul>

            <table cellspacing="0">
            <thead>
				<tr>
					<td style="width:100px">訂單編號</td>
					<td style="width:80px">金流編號</td>
					<td style="width:150px">訂單日期</td>
					<td style="width:100px">收件人</td>
					<td style="width:80px">付款方式</td>
					<td style="width:30px">訂單金額</td>
					<td style="width:30px">付款金額</td>
                    <td style="width:70px">訂單狀態</td>
					<td style="width:70px">訂購明細</td>
					<td style="width:70px">會員資料</td>
				</tr>
			</thead>
            <%if (Model != null){%>
             <tbody>
            <%foreach (var item in Model)
            {  %>
        	    <tr>
                    <td><%:item.OTXID %></td>
                    <td><%:item.OCASHID %></td>
                    <td><%:item.ORDERDATE.ToString("yyyy/MM/dd HH:mm:ss")%></td>
                    <td><%:item.RCNAME %></td>
                    <td><%=Html.GetPayType(item.PAYTYPE)%></td>
                    <td><%:item.ORDERPRICE %></td>
                    <td><%:item.ORDERPAYPRICE %></td>
                    <td><%=Html.GetOrderStatus((MensUnoShop.Models.Config.OrderStatusType)item.OSTATUS)%></td>
                    <td><a id="OrderDetail" name="OrderDetail" class="iframe" href="OrderDetailView/<%:item.OGUID %>">訂購明細</a></td>
                    <td><a id="MemberDetail" name="MemberDetail" class="iframe" href="/Admin/MemberManagement/MemberDetailView/<%:item.MGUID %>">會員資料</a></td>
                </tr>
            <%} %>
            </tbody>
            <%} %>
            </table>

            <ul class="pagination" style="margin-top:-60px;">
            <%= Html.UPager(Model.PageSize, Model.PageNumber, Model.TotalItemCount)%>
            </ul>
            <br/><br/>　
        </div>

<script type="text/javascript">
    $("a#OrderDetail").fancybox({ width: 810 });
    $("a#MemberDetail").fancybox({ height: 400, scrolling: 'no' });
</script>

</asp:Content>
